<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
<%@ page import="java.util.*, java.io.*" %>

<head>
	<script src="//ajax.googleapis.com/ajax/libs/jquery/1.6.1/jquery.min.js" type="text/javascript"></script>
	<title>Students Calendars</title>
	<meta http-equiv="content-type" content="text/html; charset=utf-8" />
	<link href="style/default.css" rel="stylesheet" type="text/css" media="screen" />
</head>

<body>
	<%String login = (String)request.getSession().getAttribute("username");
		%>
	<script type="text/javascript">                                         
	$(document).ready(function()
		{	
			$('.Clicklink').click(function()
				{
					$('.Clicklink').removeClass("Clicklinkactive");
					$(this).addClass("Clicklinkactive");
					if ($(this).attr("id") == "Logout"){
						window.location=("/Calendars/Homeservlet?op=" + $(this).attr("id"));
						return;
					}
					$('#page').load("/Calendars/Homeservlet?op=" + $(this).attr("id"),function(response, status, xhr) {
						  if (status == "error") {
							    var msg = "Sorry but there was an error: ";
							    $("#page").html("<br />" +"<h1>" + msg + xhr.status + " " + xhr.statusText +"</h1>" );
							  }
							});

			
				});
			$('.Clicklink').hover(function() {$(this).css('cursor','pointer');}, function() { $(this).css('cursor','auto');});
			
			 $('#registrationButton').click(function(){$('#page').load("registration.jsp",function(response, status, xhr) {
				  if (status == "error") {
					    var msg = "Sorry but there was an error: ";
					    $("#page").html("<br />" +"<h1>" + msg + xhr.status + " " + xhr.statusText +"</h1>" );
					  }
					});});
			 
		});
	</script>
	
	<hr />
	<div id="logo">
  	<h1><a href="#">Calendars </a></h1>
  	<p>for you :)</p>
	</div>

	<div id="menu">
  		<ul>
  		<% if (login != null) {
  		 %>
    		<li class="Clicklink Clicklinkactive " id="Home">Home</li>
    	
    	<%// only admin see users
    	  String admin = (String)request.getSession().getAttribute("administrator");
		  if (admin.equals("true")) {
  		 %>
    		<li class="Clicklink" id="Users">Users</li>
    	<% } %>
    		<li class="Clicklink" id="Courses">Courses</li>
   			<li class="Clicklink" id="Profile">Profile</li>
  			<li class="Clicklink" id="About">About</li>
  			<li class="Clicklink" id="Logout">Log-Out</li>
  		<% 	}
 		 %>
 		</ul>
	</div>
	
	<div id="page">
		<% if (login == null) 
		  	  {%>
			<%@ include file="login.jsp" %>
    	<%    } else{ 	%>
		     <%@ include file="Web/home.jsp" %>
		<% } %>

  	</div>
  	<div style="clear: both;">&nbsp;</div>
	<div id="footer">
  		<p id="legal">&copy;All Rights Reserved Ayoub And Adi and some guides from the wide web :P </p>
  		<p id="links"> <a href="#">Terms</a> | <a href="#">Sue us</a>  </p>
	</div>

</body>

</html>
